<?php
/**
 * Routes configuration
 *
 * In this file, you set up routes to your controllers and their actions.
 * Routes are very important mechanism that allows you to freely connect
 * different URLs to chosen controllers and their actions (functions).
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       app.Config
 * @since         CakePHP(tm) v 0.2.9
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
/**
 * Here, we are connecting '/' (base path) to controller called 'Pages',
 * its action called 'display', and we pass a param to select the view file
 * to use (in this case, /app/View/Pages/home.ctp)...
 */
 
//for articles
Router::connect(
    '/news/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'articles', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for product category
Router::connect(
    '/product-category/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'chocolates', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => 46
    )
);
//for articles
Router::connect(
    '/chocolates/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'chocolates', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for product_brand
Router::connect(
    '/brand/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'product_brand', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for product category
Router::connect(
    '/product-category/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'products', 'action' => 'category'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for product
Router::connect(
    '/product/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'products', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for recipes
Router::connect(
    '/recipe/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'recipes', 'action' => 'view'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for recipes categrry
Router::connect(
    '/recipe-category/:id-:slug', // E.g. /news/3-Showpiece-Training
    array('controller' => 'recipes', 'action' => 'category'),
    array(
        // order matters since this will simply map ":id" to
        // $articleId in your action
        'pass' => array('id', 'slug'),
        'id' => '[0-9]+'
    )
);

//for language
Router::connect('/:language',

                      array('controller' => 'pages', 'action' => 'display'),

                      array('language' => 'eng|vie'));

 

Router::connect('/:language/:controller',

                      array('action' => 'index'),

                      array('language' => 'eng|vie'));           

	Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
 * ...and connect the rest of 'Pages' controller's URLs.
 */
	Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

/**
 * Load all plugin routes. See the CakePlugin documentation on
 * how to customize the loading of plugin routes.
 */
	CakePlugin::routes();

/**
 * Load the CakePHP default routes. Only remove this if you do not want to use
 * the built-in default routes.
 */
	require CAKE . 'Config' . DS . 'routes.php';
